
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<HTML>

<HEAD>
   <TITLE>bodc2n_c</TITLE>
</HEAD>

<BODY style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<A name="TOP"></A>

<table style="text-align: left; margin-left: auto; margin-right: auto; width: 800px;"
 border="0" cellpadding="5" cellspacing="2">
  <tbody>
    <tr>
      <td style="background-color: rgb(153, 153, 153); vertical-align: middle; text-align: center;">
      <div align="right"> 
      <small><small><a href="index.html">Index Page</a></small></small>
      </div>
      <b>bodc2n_c</b> </td>
    </tr>

    <tr>
      <td style="vertical-align: top;">

<small><div align="center">
<A HREF="index.html#A">A</A>&nbsp;
<A HREF="index.html#B">B</A>&nbsp;
<A HREF="index.html#C">C</A>&nbsp;
<A HREF="index.html#D">D</A>&nbsp;
<A HREF="index.html#E">E</A>&nbsp;
<A HREF="index.html#F">F</A>&nbsp;
<A HREF="index.html#G">G</A>&nbsp;
<A HREF="index.html#H">H</A>&nbsp;
<A HREF="index.html#I">I</A>&nbsp;
<A HREF="index.html#J">J</A>&nbsp;
<A HREF="index.html#K">K</A>&nbsp;
<A HREF="index.html#L">L</A>&nbsp;
<A HREF="index.html#M">M</A>&nbsp;
<A HREF="index.html#N">N</A>&nbsp;
<A HREF="index.html#O">O</A>&nbsp;
<A HREF="index.html#P">P</A>&nbsp;
<A HREF="index.html#Q">Q</A>&nbsp;
<A HREF="index.html#R">R</A>&nbsp;
<A HREF="index.html#S">S</A>&nbsp;
<A HREF="index.html#T">T</A>&nbsp;
<A HREF="index.html#U">U</A>&nbsp;
<A HREF="index.html#V">V</A>&nbsp;
<A HREF="index.html#W">W</A>&nbsp;
<A HREF="index.html#X">X</A>&nbsp;
</div></small>
       <br>
       <table style="text-align: left; width: 60%; margin-left: auto; margin-right: auto;"
       border="0" cellspacing="2" cellpadding="2">
        <tbody>
          <tr>
            <td style="width: 50%; text-align: center;">
            <small>
              <a href="#Procedure">Procedure<br></a>
              <a href="#Abstract">Abstract<br></a>
              <a href="#Required_Reading">Required_Reading<br></a>
              <a href="#Keywords">Keywords<br></a>
              <a href="#Brief_I/O">Brief_I/O<br></a>
              <a href="#Detailed_Input">Detailed_Input<br></a>

              </small>
              </td>
              <td style="vertical-align: top; width: 50%; text-align: center;">
              <small>               <a href="#Detailed_Output">Detailed_Output<br></a>
              <a href="#Parameters">Parameters<br></a>
              <a href="#Exceptions">Exceptions<br></a>
              <a href="#Files">Files<br></a>
              <a href="#Particulars">Particulars<br></a>
              <a href="#Examples">Examples<br></a>

              </small>
              </td>
              <td style="vertical-align: top; width: 50%; text-align: center;">
              <small>               <a href="#Restrictions">Restrictions<br></a>
              <a href="#Literature_References">Literature_References<br></a>
              <a href="#Author_and_Institution">Author_and_Institution<br></a>
              <a href="#Version">Version<br></a>
              <a href="#Index_Entries">Index_Entries<br></a>
             </small>
            </td>
          </tr>
        </tbody>
</table>

<h4><a name="Procedure">Procedure</a></h4>
<PRE>
   void bodc2n_c ( SpiceInt        code,
                   SpiceInt        lenout,
                   SpiceChar     * name,
                   SpiceBoolean  * found   )

</PRE>
<h4><a name="Abstract">Abstract</a></h4>
<PRE>
   Translate the SPICE integer code of a body into a common name
   for that body.
</PRE>
<h4><a name="Required_Reading">Required_Reading</a></h4>
<PRE>
   <a href="../req/naif_ids.html">NAIF_IDS</a>
</PRE>
<h4><a name="Keywords">Keywords</a></h4>
<PRE>
   BODY
   CONVERSION


</PRE>
<h4><a name="Brief_I/O">Brief_I/O</a></h4>
<PRE>
   Variable  I/O  Description
   --------  ---  --------------------------------------------------
   code       I   Integer ID code to be translated into a name.
   lenout     I   Maximum length of output name.
   name       O   A common name for the body identified by code.
   found      O   True if translated, otherwise false.
</PRE>
<h4><a name="Detailed_Input">Detailed_Input</a></h4>
<PRE>
   code        is an integer code for a body ---
               a planet, satellite, barycenter, spacecraft,
               asteroid, comet, or other ephemeris object.

   lenout      is the maximum allowed length of the output name,
               including the terminating null character.  For example,
               if the caller wishes to be able to accept a 32-character
               name, lenout must be set to (at least) 33.  The current
               maximum name length is 32 characters, so a value of 33
               for lenout will suffice.
</PRE>
<h4><a name="Detailed_Output">Detailed_Output</a></h4>
<PRE>
   name        is a common name of the body identified by code.
               If code has more than one translation, then the
               most recently defined name corresponding to code
               is returned.  'name' will have the exact format (case
               and blanks) as when the name/code pair was defined.

               No more than lenout characters, including the
               terminating null, will be written to name.  A terminating
               null will always be written.

   found       is SPICETRUE if code has a translation.  Otherwise, found
               is SPICEFALSE.
</PRE>
<h4><a name="Parameters">Parameters</a></h4>
<PRE>
   None.
</PRE>
<h4><a name="Exceptions">Exceptions</a></h4>
<PRE>
   1) If the output string pointer is null, the error SPICE(NULLPOINTER)
      is signaled.
   
   2) If the output string has length less than two characters, it 
      is too short to contain one character of output data plus a null  
      terminator, so it cannot be passed to the underlying Fortran 
      routine.  In this event, the error SPICE(STRINGTOOSHORT) is
      signaled.
 </PRE>
<h4><a name="Files">Files</a></h4>
<PRE>
   None.
</PRE>
<h4><a name="Particulars">Particulars</a></h4>
<PRE>
   <b>bodc2n_c</b> is one of five related subroutines,

      <a href="bods2c_c.html">bods2c_c</a>      Body string to code
      <a href="bodc2s_c.html">bodc2s_c</a>      Body code to string
      <a href="bodn2c_c.html">bodn2c_c</a>      Body name to code
      <b>bodc2n_c</b>      Body code to name
      <a href="boddef_c.html">boddef_c</a>      Body name/code definition

   <a href="bods2c_c.html">bods2c_c</a>, <a href="bodc2s_c.html">bodc2s_c</a>, <a href="bodn2c_c.html">bodn2c_c</a>, and <b>bodc2n_c</b> perform translations between 
   body names and their corresponding integer ID codes which are 
   used in SPICE files and routines.

   <a href="bods2c_c.html">bods2c_c</a> is a slightly more general version of <a href="bodn2c_c.html">bodn2c_c</a>: support
   for strings containing ID codes in string format enables a caller
   to identify a body using a string, even when no name is
   associated with that body.

   <a href="bodc2s_c.html">bodc2s_c</a> is a general version of <b>bodc2n_c</b>; the routine returns either
   the name assigned in the body ID to name mapping or a string
   representation of the CODE value if no mapping exists.

   <a href="boddef_c.html">boddef_c</a> assigns a body name to ID mapping. The mapping has priority 
   in name-to-ID and ID-to-name translations.

   Refer to NAIF_ID.REQ for the list of name/code associations built into
   SPICE, and for details concerning adding new name/code
   associations at run time by loading text kernels.
</PRE>
<h4><a name="Examples">Examples</a></h4>
<PRE>
   1.  Suppose you ran the utility program SPACIT to summarize
       an SPK ephemeris file and the following data was output
       to the terminal screen.

          ----------------------------------------------------------
          Segment identifier: JPL archive 21354
          Body        : -77                         Center     : 399
          From        : 1990 DEC 08 18:00:00.000
          To          : 1990 DEC 10 21:10:00.000
          Reference   : DE-200                      SPK Type    :1
          ----------------------------------------------------------

      You could write a program to translate the body codes
      shown in the SPACIT output:

         #define MAXLEN 32
                .
                .
                .
         <b>bodc2n_c</b> ( -77, MAXLEN, body,   found );
         <b>bodc2n_c</b> ( 399, MAXLEN, center, found );

         if ( found )
            {
            printf ( &quot;body:    -77 =  %s\n&quot;, body   );
            printf ( &quot;center:  399 =  %s\n&quot;, center );
            }

      You could also read the body and center codes directly from
      the SPK files, using the appropriate DAF routines, and then
      translate them, as above.


   2.  In this example, we assume that <a href="boddef_c.html">boddef_c</a> has not been called,
       so only the set of default name/code pairs has
       been defined.

       Given these names, <a href="bodn2c_c.html">bodn2c_c</a> will return the following codes:

          Name                         Code    Found?
          ------------------------   ------    ------
          &quot;EARTH&quot;                       399    Yes
          &quot;  Earth &quot;                    399    Yes
          &quot;EMB&quot;                           3    Yes
          &quot;Solar System Barycenter&quot;       0    Yes
          &quot;SolarSystemBarycenter&quot;         -    No
          &quot;SSB&quot;                           0    Yes
          &quot;Voyager 2&quot;                   -32    Yes
          &quot;U.S.S. Enterprise&quot;             -    No
          &quot; &quot;                             -    No
          &quot;Halley's Comet&quot;                -    No


       Given these codes, <b>bodc2n_c</b> will return the following names:

          Code        Name                        Found?
          -------     -------------------         ------
          399         &quot;EARTH&quot;                     Yes
            0         &quot;SOLAR SYSTEM BARYCENTER&quot;   Yes
            3         &quot;EARTH BARYCENTER&quot;          Yes
          -77         &quot;GALILEO ORBITER&quot;           Yes
           11          -                          No
           -1          -                          No
</PRE>
<h4><a name="Restrictions">Restrictions</a></h4>
<PRE>
   None.
</PRE>
<h4><a name="Literature_References">Literature_References</a></h4>
<PRE>
   None.
</PRE>
<h4><a name="Author_and_Institution">Author_and_Institution</a></h4>
<PRE>
   N.J. Bachman    (JPL)
   K.R. Gehringer  (JPL)
   B.V. Semenov    (JPL)
</PRE>
<h4><a name="Version">Version</a></h4>
<PRE>
   -CSPICE Version 2.2.2, 24-APR-2010 (EDW) 

       Edit to Particulars section to document the <a href="bodc2s_c.html">bodc2s_c</a> routine.
       Minor edit to code comments eliminating typo.

   -CSPICE Version 2.2.1, 27-FEB-2008 (BVS)

       Corrected the contents of the Required_Reading section of 
       the header.

   -CSPICE Version 2.2.0, 02-SEP-1999 (NJB)  
   
      Local type logical variable now used for found flag used in
      interface of bodc2n_.
            
   -CSPICE Version 2.1.1, 25-MAR-1998 (EDW)
     
      Minor corrections to header.

   -CSPICE Version 2.1.0, 09-FEB-1998 (NJB)

      Re-implemented routine without dynamically allocated, temporary 
      strings.  Updated the Exceptions header section.
 
   -CSPICE Version 2.0.1, 16-JAN-1998 (EDW)

       Corrected and clarified header entries.

   -CSPICE Version 1.0.0, 25-OCT-1997 (NJB)

      Based on SPICELIB Version 1.0.0, 23-JAN-1996 (KRG)
</PRE>
<h4><a name="Index_Entries">Index_Entries</a></h4>
<PRE>
   body id code to name
</PRE>
<h4>Link to routine bodc2n_c source file <a href='../../../src/cspice/bodc2n_c.c'>bodc2n_c.c</a> </h4>

      </td>
    </tr>
  </tbody>
</table>

   <pre>Wed Jun  9 13:05:19 2010</pre>

</body>
</html>

